<?php
/* @var $this TutorialsController */
/* @var $model Tutorials */
/* @var $form CActiveForm */
?>
<?php 
	$js = "
		$('#Tutorials_tutorial_type_id').change(function(){
				var value = $('#Tutorials_tutorial_type_id :selected').text();
				if(value == 'PDF'){
						$('#for_video').hide();
						$('#for_pdf').show();
					}
				else if(value == 'Video'){
						$('#for_video').show();
						$('#for_pdf').hide();
					}
			});
	";
	Yii::app()->clientScript->registerScript('HideandShow', $js, CClientScript::POS_READY);
 ?>
<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'tutorials-form',
	'htmlOptions'=>array(
		'enctype' => 'multipart/form-data',
	),
	// Please note: When you enable ajax validation, make sure the corresponding
	// controller action is handling ajax validation correctly.
	// There is a call to performAjaxValidation() commented in generated controller code.
	// See class documentation of CActiveForm for details on this.
	'enableAjaxValidation'=>false,
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>

	<div class="row">
		<?php echo $form->labelEx($model,'title'); ?>
		<?php echo $form->textField($model,'title',array('size'=>60,'maxlength'=>255)); ?>
		<?php echo $form->error($model,'title'); ?>
	</div>
<!-- Tutorials_tutorial_type_id -->
<!--  -->
<!--  -->
	<div class="row">
		<?php echo $form->labelEx($model,'tutorial_type_id'); ?>
		<?php echo $form->dropDownList($model,'tutorial_type_id', CHtml::listData(TutorialType::model()->findAll(), 'id', 'type_name'), array('class'=>'my-drop-down', 'options'=>array('1'=>array('selected'=>"selected")))); ?>
		<?php echo $form->error($model,'tutorial_type_id'); ?>
	</div>
		
	<div class="row" id="for_video" hidden="false">
		<?php echo $form->labelEx($model1,'location'); ?>
		<?php echo $form->textArea($model1,'location', array('rows'=>'6', 'columns'=>'60')); ?>
        <?php echo $form->error($model1,'location'); ?>
	</div>
    
    <div class="row" id="for_pdf">
		<?php /*?><!--<?php echo $form->labelEx($model,'location'); ?>
		<?php echo $form->textField($model,'location'); ?>
		<?php echo $form->error($model,'location'); ?>--><?php */?>
        <?php echo CHtml::activeFileField($model, 'document'); ?>
		<?php echo CHtml::activeFileField($model, 'document1'); ?>
        <?php echo CHtml::activeFileField($model, 'document2'); ?>
        <?php //echo CHtml::endForm(); ?>
	</div>

	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->